
const { check } = require('express-validator'); //数据验证
const router = require('express').Router({

});
const facultiesControllers = require("../controllers/facultiesControllers");
const specializedControllers = require("../controllers/specializedControllers");
const classControllers = require("../controllers/classControllers");
const teacherControllers = require("../controllers/teacherControllers");
const roleControllers = require("../controllers/roleControllers");




/* GET */
router.get(
  '/faculties',
  async function (req, res, next) {
    let data = await facultiesControllers.selectAuthList();
    res.sendResult(data, 200, "请求成功");
  }
);

router.get(
  '/specialized',
  async function (req, res, next) {
    let data = await specializedControllers.selectAuthList();
    res.sendResult(data, 200, "请求成功");
  }
);

router.get(
  '/class',
  async function (req, res, next) {
    let data = await classControllers.selectAuthList();
    res.sendResult(data, 200, "请求成功");
  }
);

router.get(
  '/teacher',
  [
    check('teacher_name').notEmpty().withMessage('teacher_name不能为空！'),
  ],
  async function (req, res, next) {
    let data = await teacherControllers.selectAuthList(req.query.teacher_name);
    res.sendResult(data, 200, "请求成功");
  }
);

router.get(
  '/role',
  async function (req, res, next) {
    let data = await roleControllers.selectAuthList();
    res.sendResult(data, 200, "请求成功");
  }
);

module.exports = router;

